package com.cedric.yixianpai.game.cards.Sects.swordCards.a_LianQi;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 云剑·厚土
 */
@Component
public class Yun_HouTu extends SwordCard {
    /**
     * 云剑·厚土
     * 4/6/8+盾4/6/8
     */
    public Yun_HouTu(@Value("1") int lvl) {
        super("云剑·厚土");
        this.setPeriod(Period.LIANQI);
        this.setDescription("4/6/8攻 连云：护盾+4/6/8");
        this.setCardType(CardType.YUN);
        if (1==lvl) {
            this.setLevel(1);
            this.setDamage(4);
            this.setShield(4);
        } else if (2==lvl) {
            this.setLevel(2);
            this.setDamage(6);
            this.setShield(6);
        } else if (3==lvl) {
            this.setLevel(2);
            this.setDamage(8);
            this.setShield(8);
        }else{
            throw new RuntimeException("卡牌等级错误！");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.attack(Sta2,this.getDamage());
        Sta1.getPlayerBuff().setSwordIntent(0);
        if(Sta1.getPlayerBuff().getLastUseType()==CardType.YUN){
            Sta1.getPlayerBuff().addShield(this.getShield());
        }
        return true;
    }
}
